package com.jiaai.web.pay;

import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 * TODO
 * </p>
 *
 * @author 佳爱网络科技
 * @version V1.0
 * @title PayRequestData
 * @since 2017/11/16
 */
public class PayRequestData  {
    /**
     * 业务侧订单号
     */
    private  String business_no;
    /**
     * 订单金额，单位为分
     */
    private  int amount;
    /**
     * 商家渠道
     */
    private  String mertype="live";

    /**
     * 抵扣金币数
     */
    private  int  gold=0;
    /**
     * 抵扣积分
     */
    private  int  integrate=0;
    /**
     * 页面回调地址
     */
    private  String page_url="http://jiai.tpddns.cn:8977/api/v1/pay/succsesspage";
    /**
     * 支付结果通知地址
     */
    private  String notify_url="http://jiai.tpddns.cn:8977/api/v1/pay/payCallback";

    private String product_show_url="http://jiai.tpddns.cn:8977/api/v1/pay/page";
    private String mobile;
    private String products;
    private  String nonce_str=RandomStringGenerator.getRandomStringByLength(32);
    private  String sign="";

    public String getBusiness_no() {
        return business_no;
    }

    public void setBusiness_no(String business_no) {
        this.business_no = business_no;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public String getMertype() {
        return mertype;
    }

    public void setMertype(String mertype) {
        this.mertype = mertype;
    }

    public int getGold() {
        return gold;
    }

    public void setGold(int gold) {
        this.gold = gold;
    }

    public int getIntegrate() {
        return integrate;
    }

    public void setIntegrate(int integrate) {
        this.integrate = integrate;
    }

    public String getPage_url() {
        return page_url;
    }

    public void setPage_url(String page_url) {
        this.page_url = page_url;
    }

    public String getNotify_url() {
        return notify_url;
    }

    public void setNotify_url(String notify_url) {
        this.notify_url = notify_url;
    }

    public String getProduct_show_url() {
        return product_show_url;
    }

    public void setProduct_show_url(String product_show_url) {
        this.product_show_url = product_show_url;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getProducts() {
        return products;
    }

    public void setProducts(String products) {
        this.products = products;
    }

    public String getNonce_str() {
        return nonce_str;
    }

    public void setNonce_str(String nonce_str) {
        this.nonce_str = nonce_str;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public Map<String,String> toMap(){
        Map<String,String> map = new HashMap<String, String>();
        Field[] fields = this.getClass().getDeclaredFields();
        for (Field field : fields) {
            Object obj;
            try {
                obj = field.get(this);
                if(obj!=null){
                    map.put(field.getName(), String.valueOf(obj));
                }
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
        }
        return map;
    }
}
